//
//  KXNavigationViewController.swift
//  KXBook
//
//  Created by  on 2022/9/7.
//

import UIKit

class KXNavigationViewController: UINavigationController {

    override func viewDidLoad() {
        super.viewDidLoad()
        self.setupColor()
    }
    
    func setupColor()
    {
        self.navigationBar.isTranslucent = false
    }
    
    override func pushViewController(_ viewController: UIViewController, animated: Bool) {
        if self.viewControllers.count > 0{
            viewController.hidesBottomBarWhenPushed = true
        }
        super.pushViewController(viewController, animated: animated)
    }
    
    override func popViewController(animated: Bool) -> UIViewController? {
        if self.children.count <= 2{
            self.tabBarController?.tabBar.isHidden = false
        }
        return super.popViewController(animated: animated)
    }
    
    override var childForStatusBarStyle: UIViewController?{
        return self.topViewController
    }

}
